/*
 * KeyEvents
 * 
 * PSprite provides a simple API for handling key events.
 * Subclasses can override the following PSprite methods
 * to handle key events:
 * - keyPressed()
 * - keyReleased()
 * - keyTyped()
 * 
 * A PSprite instance will only receive key events if it is
 * currently on the display list, so be sure to addChild() it
 * to PSpriteContainer or to an other PSprite that is already
 * on the display list before attempting to handle key events.
 */

import com.transmote.psg.*;
import com.transmote.psg.events.*;

PSpriteContainer spriteContainer;

void setup () {
  size(400, 400);
  setupSprites();
}

void draw () {
  background(0);
  spriteContainer.update();
}

void setupSprites () {
  // create a PSpriteContainer to hold all other PSprites
  spriteContainer = new PSpriteContainer(this);
  
  // attach ButtonSprite instances to the SpriteContainer
  MoverSprite mover = new MoverSprite();
  mover.x = 150;
  mover.y = 150;
  spriteContainer.addChild(mover);
}
